/*
 * @Description:
 * @Author: zhangwei
 * @Date: 2023-02-02 15:52:39
 * @LastEditTime: 2023-02-11 10:17:50
 * @LastEditors: zw 775925302@qq.com
 */
import { createRouter, createWebHistory } from "vue-router";
import WebDesigner from "../views/designer/phone/index.vue";

import TestDemo from "../views/dnd/test.vue";

import Dnd01 from "../views/dnd/eg01/index.vue";
import Dnd02 from "../views/dnd/eg02/index.vue";
import Dnd03 from "../views/dnd/eg03/index.vue";
import Dnd04 from "../views/dnd/eg04/index.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // {
    //   path: "/",
    //   name: "test",
    //   component: TestDemo,
    // },
    {
      path: "/",
      name: "designer",
      component: WebDesigner,
    },


    {
      path: "/dnd01",
      name: "dnd01",
      component: Dnd01,
    },
    {
      path: "/dnd02",
      name: "dnd02",
      component: Dnd02,
    },
    {
      path: "/dnd03",
      name: "dnd03",
      component: Dnd03,
    },
    {
      path: "/dnd04",
      name: "dnd04",
      component: Dnd04,
    }



  ],
});

export const resetRouter = (): void => {
  const resetWhiteNameList = ["Redirect", "Login", "NoFind", "Root"];
  router.getRoutes().forEach((route) => {
    const { name } = route;
    if (name && !resetWhiteNameList.includes(name as string)) {
      router.hasRoute(name) && router.removeRoute(name);
    }
  });
};

export default router;
